import { createStore } from 'vuex'
// 创建一个新的 store 实例
const store = createStore({
    state () {
      return {
        count: {name: 'tang'},
        chinaData: [],
        provinceData: {}
      }
    },
    mutations: {
      handleChinaData (state,val) {
         state.chinaData = val
      },
      handleProvinceData (state,val) {
        state.provinceData = val
     }
    },
    actions: {
      getData({ commit, state},val) {
        commit('handleChinaData',val)
      },
      getProvinceData({ commit, state},val) {
        commit('handleProvinceData',val)
      }
    }
  })
  
  export default store
